﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <meta name="renderer" content="webkit">
    <title>大众之旅</title>
    <link href="/static/home/css/normalize.css" rel="stylesheet">
    <link href="/static/home/css/bootatrap/bootstrap.min.css" rel="stylesheet">
    <link href="/static/home/css/mixin.css" rel="stylesheet">
    <link href="/static/home/css/style.css" rel="stylesheet">
</head>

<body>
    <!-- 头部 -->
    <header class="boder_bn">
        <div class="top">
            <div class="typearea">
                <div class="fl">
                    <span>欢迎来到大众之旅!</span>
                    <a href="{:url('login/login')}" class="login_ing"><span class="ml_15 color_o">请登录</span></a>
                    <a href="{:url('login/register')}" class="login_ing"><span class="ml_15">会员注册</span></a>
                    <a class="login_ed"><span class="ml_15 color_o">{if $Think.session.userinfo.username}{$Think.session.userinfo.username}{else}{$Think.session.userinfo.phone}{/if}</span></a>
                    <a class="login_ed login_out" style="cursor:pointer;"><span class="ml_15">退出!</span></a>
                </div>
                <div class="fr">
                    <a href="{:url('my/my')}#order"><span>我的订单</span></a>
                    <a href="{:url('my/my_cart')}"><span class="ml_30">我的购物车</span></a>
                </div>
            </div>
        </div>
        <div class="center">
            <div class="typearea">
                <div class="fl">
                    <img class="logo_img" src="/static/home/img/logo.png" alt="">
                </div>
                <div class="fr">
                    <div class="search input-group">
                        <input type="text" class="form-control" name="keyword">
                        <div class="search_btn btn-group">
                            <a id="search" class="btn">
                                <img src="/static/home/img/s.jpg" alt="">
                            </a>
                        </div>
                    </div>
                    <!-- <div class="mycart">
                        <img src="/static/home/img/cart.png" alt="">
                        <span>我的购物车(0)</span>
                    </div> -->
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="typearea">
                <div class="fl">
                    <!-- Single button -->
                    <div class="btn-group">
                        <div class="all_product">
                            <div data-toggle="dropdown"
                                aria-haspopup="true" aria-expanded="false">
                                全部商品分类 <span class="caret"></span>
                            </div>
                            <ul class="dropdown-menu" style="height:unset;">
                                {foreach $cates as $key=>$value }
                                    <li>
                                        <a href="{:url('product/product')}?c_id={$value.id}">
                                            <div class="fl">
                                                <p>{$value.catename}</p>
                                                <p class="gray">{$value.intro}</p>
                                            </div>
                                            <span class="glyphicon glyphicon-menu-right fr"></span>
                                        </a>
                                    </li>
                                {/foreach}
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="fr">
                    <ul>
                        <li><a href="{:url('index/index')}">商城首页</a></li>
                        <li><a href="{:url('product/product')}">农副产品</a></li>
                        <li><a href="{:url('scenic/scenic')}?flag_type=0">景区门票</a></li>
                        <li><a href="{:url('scenic/scenic')}?flag_type=2">免费景区</a></li>
                        <li><a href="{:url('product/product')}?discount=1">折扣专区</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </header>
    <div class="submitOrder">
        <div class="typearea">
            <!-- 进度 -->
            <div class="header">
                <div>1.产品/门票</div>
                <img src="/static/home/img/next2.jpg" alt="">
                <div class="header_act">2.填写订单信息</div>
                <img src="/static/home/img/next2.jpg" alt="">
                <div>3.成功提交订单</div>
            </div>
            <!-- 收货地址 -->
            <div class="address">
                <div class="addr_title">
                    <div>收货地址</div>
                    <!-- <div class="fr">管理收货地址</div> -->
                </div>
                <div class="addr_item addr_item_act">
                    <div class="top">
                        {$address.name} （{$address.phone}）
                    </div>
                    <div class="center">
                        {$address.province}&nbsp;{$address.city}&nbsp;{$address.district}&nbsp;{$address.address}
                    </div>
                    <!-- <div class="edit">修改</div> -->
                </div>
            </div>
            <!-- 确认订单信息 -->
            <div class="order_Info">
                <div class="title">
                    确认订单信息
                </div>
                <div class="top">
                    <ul>
                        <li>商品</li>
                        <li>规格</li>
                        <li>单价(元)</li>
                        <li>数量</li>
                        <li>小计</li>
                    </ul>
                </div>
                <div class="info_box">
                    <ul>
                        <li>
                            <img src="{$productDetail.img}" style="width:50px;">
                            <span class="ml_10">{$productDetail.title}</span>
                        </li>
                        <li>{$productDetail.combination}</li>
                        <li>{$productDetail.price}</li>
                        <li>
                            <div class="box">
                                <button style="font-size:14px;padding:0 10px;" class="buy_dec">-</button>
                                <input style="width:38px;text-align:center;border-left:1px solid #e3e3e3;border-right:1px solid #e3e3e3;" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" type="number" name="buy_num" value="{$buy_num}">
                                <button style="font-size:14px;padding:0 10px;" class="buy_inc">+</button>
                            </div>
                        </li>
                        <li class="small_total">{:bcmul($productDetail.price,$buy_num,2)}</li>
                    </ul>
                    <div class="info_box_desc">
                        <div class="fr">
                            <div class="fr_l">
                                <div>服务</div>
                                <div class="mt_20">配送方式</div>
                                <div class="mt_20">备注</div>
                            </div>
                            <div  class="fr_r">
                                <div>此商品不支持7天退货</div>
                                <div class="mt_20">
                                    <span>普通快递</span>
                                    <span class="price">免邮</span></span>
                                </div>
                                <div class="mt_20">特别需求请和商家协商</div>
                            </div>
                        </div>
                    </div>
                    <div class="total">
                        <span>共&nbsp;<i class="count_total">{$buy_num}</i>&nbsp;件</span>
                        <span class="total_price">共计<span>¥<span class="all_total">{:bcmul($productDetail.price,$buy_num,2)}</span></span></span>
                    </div>
                </div>
                <div class="pay">
                    <div class="pay_info">总价：<span class="price">¥<span class="count_prices">{:bcmul($productDetail.price,$buy_num,2)}</span></span></div>
                    <div class="pay_now btn-group">
                        <div class="btn">立即付款</div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <!-- 尾部 -->
    <footer>
        <div class="f_top">
            <div class="typearea">
                <ul>
                    <li>
                        <img src="/static/home/img/b1.jpg" alt="">
                        <span>正品保障</span>
                    </li>
                    <li>
                        <img src="/static/home/img/b2.jpg" alt="">
                        <span>好评如潮</span>
                    </li>
                    <li>
                        <img src="/static/home/img/b3.jpg" alt="">
                        <span>闪电发货</span>
                    </li>
                    <li>
                        <img src="/static/home/img/b4.jpg" alt="">
                        <span>权威荣誉</span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="f_center">
            <div class="typearea">
                <div class="contact">
                    <div class="con_t">
                        <img src="/static/home/img/b5.jpg" alt="">
                        <div class="con_tr ml_10">
                            <div>{$system.ser_tel}</div>
                            <div>服务时间：{$system.ser_time}</div>
                        </div>
                    </div>
                    <div class="mt_20">地址：{$system.address}</div>
                    <div class="mt_20">邮箱：{$system.email}</div>
                </div>
                <ul>
                    <li>购物指南</li>
                    <li><a href="javascript:0">我的购物车</a></li>
                    <li><a href="javascript:0">查看订单</a></li>
                    <li><a href="javascript:0">取消订单</a></li>
                </ul>
                <ul>
                    <li>帮助中心</li>
                    <li><a href="javascript:0">用户注册</a></li>
                    <li><a href="javascript:0">用户登录</a></li>
                    <li><a href="javascript:0">配送说明</a></li>
                </ul>
                <ul>
                    <li>服务保证</li>
                    <li><a href="javascript:0">产品质量保证</a></li>
                    <li><a href="javascript:0">售后服务保证</a></li>
                    <li><a href="javascript:0">联系我们</a></li>
                </ul>
                <div class="fr">
                    <div>
                        <div id="qy_qrcode">
                            
                        </div>
                        <p style="text-align:center;">企业官网</p>
                    </div>
                    <div class="ml_30">
                        <div id="shop_qrcode">
                            
                        </div>
                        <p style="text-align:center;">微信商城</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="f_bottom">
            <div class="typearea">
                版权所有 ©{$system.copyright}&nbsp;&nbsp;&nbsp;&nbsp;{$system.company}&nbsp;&nbsp;&nbsp;&nbsp;{$system.icp}
            </div>
        </div>
    </footer>
    <script src="/static/home/js/bootstrap/jquery.min.js"></script>
    <script src="/static/home/js/bootstrap/bootstrap.min.js"></script>
    <script src="/static/lib/layer/2.4/layer.js"></script>
    <script src="/static/home/js/qrcode.min.js"></script>
    <script type="text/javascript">
        var qrcode = new QRCode(document.getElementById("qy_qrcode"), {
            text: "{$url}/index/index/index.html",
            width: 88,
            height: 88,
            colorDark : "#000000",
            colorLight : "#ffffff",
            correctLevel : QRCode.CorrectLevel.H
        });

        var qrcode = new QRCode(document.getElementById("shop_qrcode"), {
            text: "{$url}/h5/index.html",
            width: 88,
            height: 88,
            colorDark : "#000000",
            colorLight : "#ffffff",
            correctLevel : QRCode.CorrectLevel.H
        });
        $(function(){
            if(window.localStorage.getItem("Token")){
                $(".login_ing").css("display","none");
                $(".login_ed").css("display","unset");
            }
            $(".login_out").click(function() {
                window.localStorage.setItem("Token",'');
                $(".login_ing").css("display","unset");
                $(".login_ed").css("display","none");
                $.ajax({
                    type: 'POST',
                    url: "{:url('/shop/login/login_out')}",
                    data:{},
                    success: function(data){
                        console.log(data)
                        window.location.href="/shop/index/index.html";
                    },
                    error:function(data) {
                        console.log(data.msg);
                    },
                }); 
            });
        });
        $(".buy_dec").click(function() {
            var buy_num=$("input[name=buy_num]").val();
            if(buy_num>=2){
                buy_num--;
            }
            $("input[name=buy_num]").val(buy_num);
            var small_total=buy_num*`{$productDetail.price}`
            small_total=small_total.toFixed(2)
            $(".small_total").text(small_total);
            $(".count_total").text(buy_num);
            $(".all_total").text(small_total);
            $(".count_prices").text(small_total);
        });
        $(".buy_inc").click(function() {
            var buy_num=$("input[name=buy_num]").val();
            if(buy_num<`{$productDetail.num}`){
                buy_num++;
            }else{
                layer.msg('库存不足',{icon:2,time:3000});
            }
            $("input[name=buy_num]").val(buy_num);
            var small_total=buy_num*`{$productDetail.price}`
            small_total=small_total.toFixed(2)
            $(".small_total").text(small_total);
            $(".count_total").text(buy_num);
            $(".all_total").text(small_total);
            $(".count_prices").text(small_total);
        });
        $(".addr_item_act").click(function() {
            window.location.href="/shop/my/my.html#address";
        });
        $(".pay_now").click(function() {
            var token=window.localStorage.getItem("Token");
            var address_id="{$address.id}";
            var address="{$address.province}{$address.city}{$address.district}{$address.address}";
            var uname="{$address.name}";
            var uphone="{$address.phone}";
            var spec_combination_id="{$spec_combination_id}";
            var price="{$productDetail.price}";
            var buy_nums=$("input[name=buy_num]").val();
            var pay_fees=$(".count_prices").text();
            var combination="{$productDetail.combination}";
            var title="{$productDetail.title}";
            var p_id="{$productDetail.id}";
            $.ajax({
                type: 'POST',
                url: "{:url('orderin')}",
                data:{
                    token:token,
                    deduct_moneys:0,
                    title:title,
                    combination:combination,
                    pay_fees:pay_fees,
                    buy_num:buy_nums,
                    price:price,
                    spec_combination_id:spec_combination_id,
                    name:uname,
                    phone:uphone,
                    address:address,
                    address_id:address_id,
                    p_id:p_id
                },
                success: function(res){
                    if (res.code==200) {
                        window.location.href="/shop/order/payment.html?title={$productDetail.title}&pay_fees="+pay_fees+"&orderno="+res.data.orderno+"&qrcode_url="+res.data.qrcode_url;
                    }else{
                        layer.msg(res.msg,{icon:2,time:3000});
                    }
                },
                error:function(res) {
                    layer.msg(res.msg,{icon:2,time:3000});
                },
            });
            
        });
        $("#search").click(function() {
            layer.load(1, {
              shade: [0.1,'#fff'] //0.1透明度的白色背景
            });
            var keyword=$("input[name=keyword]").val();
            window.location.href="{$url}/shop/product/product.html?keyword="+keyword
            ;
        });
    </script>
</body>

</html>